#!/bin/bash
passwd=123456
date_file=`date +%Y%m%d`
date_back_file=`date +%Y%m%d%H%M`
#echo $date_file

item=UFC-JP_item_CBT
home_bash=/data/www
game_path=$home_bash/$item/game
game_rsync_path=$home_bash/$item/game
gameblank_path=$home_bash/$item/back_releaseDB
update_code_path=$home_bash/$item/update_code
cp_path=$update_code_path/cphome
md5_file_path=$update_code_path/md5_home
rsync_md5_path=$md5_file_path/rsync_md5
release_path=$update_code_path/release
u_file_list=file_list
ts_ip=210.14.156.87
ws_ip=10.104.138.221
fs_ip=119.29.36.206
apk_gc_ip=10.104.138.214
apk_tx_ip=10.251.92.144
ios_ip=10.104.136.166
iosjb_ip=119.29.148.212
ios_app=10.104.38.72
servert_path=$update_code_path/server/ts/config
serverg_path=$update_code_path/server/gs/config
serverf_path=$update_code_path/server/fs/config
serveri_path=$update_code_path/server/is/config
serverjb_path=$update_code_path/server/is/isjb/config
serveria_path=$update_code_path/server/is/appstore/config
servera_path=$update_code_path/server/as/config
servera_gc_path=$update_code_path/server/as/gc/config
servera_tx_path=$update_code_path/server/as/tx/config
hosts_path=$update_code_path/hosts_ip

#版本备份
function cgrb
{
echo -n "$date_file备份专服目录:"
ls -l $gameblank_path/$date_file | awk '{print $9}'
echo -n 请输入备份专服目录:
#read Hb_dir
Hb_dir=$1
mkdir -p $gameblank_path/$date_file/$1
echo $gameblank_path/$date_file/$1
echo -e "\033[31m $Hb_dir: \033[0m"
echo ""
echo -n "$date_file/$Hb_dir专服版本目录:"
ls -l $gameblank_path/$date_file/$Hb_dir | awk '{print $9}'
echo ""
echo -n 备份后版本库版本号:
#read Hb_t
Hb_t=$Hb_dir_$date_back_file
echo -e "\033[31m $Hb_t: \033[0m"
#last_t_continue "检查版本号是否正确:"
                if [ ! -d $gameblank_path/$date_file/$Hb_dir/$Hb_t ];then
                mkdir -p $gameblank_path/$date_file/$Hb_dir/$Hb_t
                else
                rm -rf $gameblank_path/$date_file/$Hb_dir/$Hb_t/*
                fi
cd $game_path
cp -r ./* $gameblank_path/$date_file/$Hb_dir/$Hb_t/
#find ./ -type f -print0 | xargs -0 md5sum > $md5_file_path/mygame.md5
}

cgrb $1


